package test;

public class ThreadTest2 implements Runnable {
	
	
	
	
	
	
	

	@Override
	public void run() {
			long startTime=System.currentTimeMillis();
		 for (int i = 0; i < 10000000; i++) {
	            //System.out.println( "运行  :  " + i);
	            try {
	            	Thread.sleep((int) Math.random() * 10);
	            } catch (InterruptedException e) {
	                e.printStackTrace();
	            }
	}
		
		 long endTime=System.currentTimeMillis();
		 
		 System.out.println("耗时:"+(endTime-startTime));
}
	
	public static void main(String[] args) {
		
		Thread thread=new Thread(new ThreadTest2());
		thread.start();
		
		
	}
}
